<template>
  <!-- 统一的左部导航栏 -->
      <el-menu
        :default-active="activeIndex"
        class="el-menu-vertical-demo"
        background-color="#2f3447"
        text-color="#fff"
        unique-opened
      >
        <el-submenu index="userManager">

          <template slot="title">
            <i class="el-icon-s-custom"></i>
            <span>用户管理</span>
          </template>

          <el-menu-item-group>
            <el-menu-item index="studentInfo" @click="go('studentInfo')"> 学生信息 </el-menu-item>
            <el-menu-item index="teacherInfo" @click="go('teacherInfo')"> 老师信息 </el-menu-item>
          </el-menu-item-group>

        </el-submenu>

        <el-menu-item index="TK" @click="go('TK')">

            <i class="el-icon-s-home"></i>
            <span>题库管理</span>

        </el-menu-item>

        <el-menu-item index="classInfo" @click="go('classInfo')">

            <i class="el-icon-postcard"></i>
            <span>班级管理</span>

        </el-menu-item>

        <el-menu-item index="subjectInfo" @click="go('subjectInfo')">

            <i class="el-icon-postcard"></i>
            <span>课程管理</span>

        </el-menu-item>

      </el-menu>

</template>

<script>
export default {
  name: "LeftSiderBar",
  data() {
    return {
      activeIndex:"stu"
    };
  },
  methods: {
    go(path){
      path = "/admin/"+path
      if(this.$route.path != path){
        this.$router.push(path)
      }
    }
  },
  mounted(){
    this.activeIndex = this.$route.name
  }
};
</script>

<style scoped>

</style>
